<?php
/**
 * 问题接口
 * 
 * @author river_he@eueang.com
 */
final class Gos_Controller_Quest extends Gospel_Controller_Api {
	/**
	 * 分发action之前
	 * 
	 * @param Gospel_Http_Request_Abstract $request
	 * @return void
	 */
	protected function beforeDespatch(Gospel_Http_Request_Abstract &$request){
		$act = $request->getAction();
		if(is_numeric($act)){
			$request->setItem('act', 'info');
			$request->setItem('qid', $act);
		}
	}
	
	/**
	 * 默认首页
	 */
	public function indexAction(){
		header('HTTP/1.1 404 NOT FOUND');
	}
	
	/**
	 * 试题详情
	 * 
	 * @return void
	 * @throws Gospel_Controller_Api_Exception
	 */
	public function infoAction(){
		$questId = $this->getRequest()->getInt('qid');
		if($questId > 0){
			$questModule = new Gos_Model_Question();
			$where = 'nId='.$questId;
			$questModule->getItem($where, true);
		}else{
			throw new Gospel_Controller_Api_Exception(404, 'Argument qid is error.');
		}
	}
}